package com.mikelouis.test.scala.proginscala.chapter14

import org.scalatest.FunSpec

/**
 * Created by yuazhu on 1/18/2015.
 */
class Element2ScalaTestSpecTestSuite extends FunSpec {
  describe("A Uniform Element") {
    it("should have a width equal to the passed value") {
      val ele = Element2.elem('x', 2, 3)
      assert(ele.width === 2)
    }

    it("should have a height equal to the passed value") {
      val ele = Element2.elem('x', 2, 3)
      assert(ele.height === 3)
    }

    it("should throw an IAE if passed a negative width") {
      intercept[IllegalArgumentException] {
        Element2.elem('x', -2, 3)
        throw new IllegalArgumentException("manually throw IllegalArgumentException")
      }
    }
  }


}
